package com.beike.mapper;

import com.beike.entity.LessonDesign;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface LessonDesignMapper {

    @Insert("INSERT INTO lesson_designs (name, grade, subject, duration, knowledge_goals, skill_goals, emotional_goals, activities) " +
            "VALUES (#{name}, #{grade}, #{subject}, #{duration}, #{knowledgeGoals}, #{skillGoals}, #{emotionalGoals}, #{activities})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(LessonDesign design);

    @Select("SELECT * FROM lesson_designs WHERE id = #{id}")
    LessonDesign selectById(Long id);

    @Select("SELECT * FROM lesson_designs")
    List<LessonDesign> selectAll();

    @Update("UPDATE lesson_designs SET name=#{name}, grade=#{grade}, subject=#{subject}, duration=#{duration}, " +
            "knowledge_goals=#{knowledgeGoals}, skill_goals=#{skillGoals}, emotional_goals=#{emotionalGoals}, " +
            "activities=#{activities} WHERE id = #{id}")
    int update(LessonDesign design);

    @Delete("DELETE FROM lesson_designs WHERE id = #{id}")
    int deleteById(Long id);
} 